<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>

    var user = {
        name: "John",
        age: 10,
        /*   eat: function () {
               alert("开吃!")
           }*/
        eat() {
            alert("开吃!");
        }
    }
    alert(user.name);
    user.eat();

</script>
</html>